package com.portal.incurridos.persistence.enumeration;

/**
 * @author Alan Dávila
 * e-mail ustargab@gmail.com
 * date 19/11/2013 00:17:16
 */
public enum StateRecordEnum {

	/**
	 * State when a project is closed.
	 */
	CLOSED(2),
	/**
	 * State enable of project, It will appear in all search.
	 */
	ENABLE(1),
	/**
	 * State disable of project, It will not appear in all search.
	 */
	DISABLE(0);
	/**
	 * Representation of state as integer.
	 */
	private Integer state;
	/**
	 * Constructor.
	 * @param stateIn New state.
	 */
	StateRecordEnum(final Integer stateIn) {
		state = stateIn;
	}
	/**
	 * Return the integer value of state.
	 * @param stateRecordEnum Enum with the state of record.
	 * @return Representation of record as integeer.
	 */
	public static Integer getStateVal(final StateRecordEnum stateRecordEnum) {
		Integer stateOut = 0;
		for (StateRecordEnum record : StateRecordEnum.values()) {
			if (record.equals(stateRecordEnum)) {
				stateOut = record.getState();
			}
		}
		return stateOut;
	}
	/**
	 * @return the state
	 */
	public Integer getState() {
		return state;
	}

}
